return $this->mPrefixedText;
}
+ /**
+ * Return the prefixed title with spaces _without_ the interwiki prefix
+ *
+ * @return \type{\string} the title, prefixed by the namespace but not by the interwiki prefix, with spaces
+ */
+ public function getSemiPrefixedText() {
+ if ( !isset( $this->mSemiPrefixedText ) ){
+ $s = ( $this->mNamespace === NS_MAIN ? '' : $this->getNsText() . ':' ) . $this->mTextform;
+ $s = str_replace( '_', ' ', $s );
+ $this->mSemiPrefixedText = $s;
+ }
+ return $this->mSemiPrefixedText;
+ }
+
/**
* Get the prefixed title with spaces, plus any fragment
* (part beginning with '#')
* @return String the URL
*/
public function getInternalURL( $query = '', $variant = false ) {
- global $wgInternalServer, $wgServer;
- $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer;
+ if ( $this->isExternal( ) ) {
+ $server = '';
+ } else {
+ global $wgInternalServer, $wgServer;
+ $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer;
+ }
$url = wfExpandUrl( $server . $this->getLocalURL( $query, $variant ), PROTO_HTTP );
wfRunHooks( 'GetInternalURL', array( &$this, &$url, $query ) );
return $url;
$this->mFragment = str_replace( '_', ' ', substr( $fragment, 1 ) );
}
+ public function setInterwiki( $interwiki ) {
+ $this->mInterwiki = $interwiki;
+ }
+
/**
* Get a Title object associated with the talk page of this article
*
* @return Mixed true on success, getUserPermissionsErrors()-like array on failure
*/
public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true ) {
+ global $wgContLang, $wgEnableInterwikiTemplatesTracking, $wgGlobalDatabase;
+
$err = $this->isValidMoveOperation( $nt, $auth, $reason );
if ( is_array( $err ) ) {
return $err;
);
}
+ if ( $wgEnableInterwikiTemplatesTracking && $wgGlobalDatabase ) {
+ $dbw2 = wfGetDB( DB_MASTER, array(), $wgGlobalDatabase );
+ $dbw2->update( 'globaltemplatelinks',
+ array( 'gtl_from_namespace' => $nt->getNamespace(),
+ 'gtl_from_title' => $nt->getText() ),
+ array ( 'gtl_from_page' => $pageid ),
+ __METHOD__ );
+ }
+
if ( $protected ) {
# Protect the redirect title as the title used to be...
$dbw->insertSelect( 'page_restrictions', 'page_restrictions',
* @param $createRedirect Bool Whether to leave a redirect at the old title. Ignored
* if the user doesn't have the suppressredirect right
*/
- private function moveToInternal( &$nt, $reason = '', $createRedirect = true ) {
- global $wgUser, $wgContLang;
+ private function moveOverExistingRedirect( &$nt, $reason = '', $createRedirect = true ) {
+ global $wgUseSquid, $wgUser, $wgContLang, $wgEnableInterwikiTemplatesTracking, $wgGlobalDatabase;
$moveOverRedirect = $nt->exists();
array( 'rc_timestamp' => $rcts, 'rc_namespace' => $newns, 'rc_title' => $newdbk, 'rc_new' => 1 ),
__METHOD__
);
+
+ if ( $wgEnableInterwikiTemplatesTracking && $wgGlobalDatabase ) {
+ $dbw2 = wfGetDB( DB_MASTER, array(), $wgGlobalDatabase );
+ $dbw2->delete( 'globaltemplatelinks',
+ array( 'gtl_from_wiki' => wfGetID(),
+ 'gtl_from_page' => $newid ),
+ __METHOD__ );
+ }
}
# Save a null revision in the page's history notifying of the move